package cn.com.api.service.impl;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.com.api.entity.ApiAddress;
import cn.com.api.mapper.ApiAddressMapper;
import cn.com.api.service.ApiAddressService;

/**
 * 收货地址服务层实现类
 * 
 * 
 */
@Service
public class ApiAddressServiceImpl implements ApiAddressService {

	@Autowired
	private ApiAddressMapper addressMapper;

	// 查询用户使用的地址
	@Override
	public List<ApiAddress> getAddressList(@Param("uid") String u_id) {
		return addressMapper.getAddressList(u_id);
	}

	// 查询用户使用的地址
	@Override
	public ApiAddress getAddressEnable(@Param("uid") String uid) {
		return addressMapper.getAddressEnable(uid);
	}

	// 更新收收获地址
	@Override
	public void update(ApiAddress apiAddress) {
		addressMapper.update(apiAddress);
	}

	// 停用所有地址
	@Override
	public boolean updateAllEnable(String u_id) {
		return addressMapper.updateAllEnable(u_id);
	}

	// 启用选中地址
	@Override
	public boolean updateSignStart(Integer id) {
		return addressMapper.updateSignStart(id);
	}

	// 根据id查询地址
	@Override
	public ApiAddress getAddressById(String id) {
		return addressMapper.getAddressById(id);
	}

	// 删除地址
	@Override
	public int deleteAddr(Integer id) {
		return addressMapper.delete(id);
	}

}
